package org.manager.upload;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/upload")
public class UploadController {

	@RequestMapping(params="method=upload")
	public void upload(HttpServletRequest request, HttpServletResponse response){
		System.out.println("访问到了____");
		String saveDir="c:/uploadFiles";//用于设置保存在哪个目录下
		RequestUpload upLoad=new RequestUpload(saveDir);
		   try{
		     if(upLoad.start(request)){
		      System.out.println("上传成功:"+upLoad.getFileName());
		     }
		   }catch(Exception e){
			   e.printStackTrace();
			   System.out.println("上传失败.");
		   }
	}
}
